New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add keyboard_layout
stanza.
#15061
Add keyboard_layout
stanza.
#15061
Conversation
7fadd1f
to
471ce0b
Compare
ecd3b84
to
c38f0c3
Compare
@@ -15,6 +15,7 @@ class Config | |||
|
|||
DEFAULT_DIRS = { | |||
appdir: "/Applications", | |||
keyboard_layoutdir: "/Library/Keyboard Layouts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keyboard_layoutdir: "/Library/Keyboard Layouts", | |
keyboard_layoutdir: "~/Library/Keyboard Layouts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is intentional. You will need sudo
to delete the cache anyways, so might as well install in the system-wide directory. Arguably, all of these should use the system-wide directory by default, but it would be pretty hard to migrate these now.
def delete_keyboard_layout_cache(command: nil, **_) | ||
command.run!("/bin/rm", args: ["-f", "--", "/System/Library/Caches/com.apple.IntlDataCache.le*"], sudo: true) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to take a command argument if it's always going to run the same command?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command
argument here contains more information than calling system_command!
directly, e.g. whether it should be verbose, so that all commands for a given cask behave the same way in terms of output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I looked at the other artifacts and see that this is a common pattern. I wonder why it accepts nil as an argument though since it seems to be required here and I couldn't find any references where the command would be nil in the cask installer.
def install_phase(**options) | ||
super(**options) | ||
delete_keyboard_layout_cache(**options) | ||
end | ||
|
||
def uninstall_phase(**options) | ||
super(**options) | ||
delete_keyboard_layout_cache(**options) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is is always necessary to delete the layout cache on both install and uninstall? The PR linked to in the homebrew/cask
repo only shows that this is done for one cask.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so, https://www.kaufmann.no/roland/dvorak/macosx.html shows its removal in both installation and removal instructions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me when it does to @apainintheneck!
Actually, looks like @apainintheneck comments addressed (please contradict me if wrong!) so merging now to hopefully get into today's release. |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?See Homebrew/homebrew-cask#143776.